package com.probox.activity.api.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.probox.common.core.annotation.Excel;
import com.probox.common.core.utils.money.MoneyUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
public class ActivityInfoProVo implements java.io.Serializable {

    /** 活动商品ID */
    @ApiModelProperty(value = "活动商品ID")
    private Long activityProUid;

    /** 活动ID */
    @Excel(name = "活动ID")
    @ApiModelProperty(value = "活动ID(活动ID)")
    private Long activityUid;

    @ApiModelProperty(value = "活动名称")
    private String activityName;

    /** 活动类型（bargain砍价/seckill秒杀/limittime限时/group拼团/free新人免费领/packages套餐/score积分兑换/recharge充值套餐） */
    @Excel(name = "活动类型" , readConverterExp = "bargain砍价/seckill秒杀/limittime限时/group拼团/free新人免费领/packages套餐/score积分兑换/recharge充值套餐")
    @ApiModelProperty(value = "活动类型(bargain砍价/seckill秒杀/limittime限时/group拼团/free新人免费领/packages套餐/score积分兑换/recharge充值套餐)")
    private String activityType;

    /** 商品ID */
    @Excel(name = "商品ID")
    @ApiModelProperty(value = "商品ID(商品ID)")
    private Long proUid;

    /** 商品名称 */
    @Excel(name = "商品名称")
    @ApiModelProperty(value = "商品名称(商品名称)")
    private String proName;

    /** 封面图 */
    @Excel(name = "封面图")
    @ApiModelProperty(value = "封面图(封面图)")
    private String imgUrl;

    /** 商品价格折扣(废弃) */
    @Excel(name = "商品价格折扣(废弃)")
    @ApiModelProperty(value = "商品价格折扣(废弃)(商品价格折扣(废弃))")
    private BigDecimal activityRate;

    /** 活动价格 */
    @Excel(name = "活动价格")
    @ApiModelProperty(value = "活动价格(活动价格)")
    private Long activityPrice;

    /** 活动库存数 */
    @Excel(name = "活动库存数")
    @ApiModelProperty(value = "活动库存数(活动库存数)")
    private Integer activityStock;

    /** 兑换所需积分 */
    @Excel(name = "兑换所需积分")
    @ApiModelProperty(value = "兑换所需积分(兑换所需积分)")
    private Long activityScore;

    /** 拼团、限时限量、秒杀、砍价时（每人限购（0不限制 */
    @Excel(name = "拼团、限时限量、秒杀、砍价时" , readConverterExp = "拼团、限时限量、秒杀、砍价时（每人限购（0不限制")
    @ApiModelProperty(value = "拼团、限时限量、秒杀、砍价时（每人限购（0不限制)")
    private Integer limitsNumber;

    /** 拼团达成数量（或者砍价的帮砍人数） */
    @Excel(name = "拼团达成数量" , readConverterExp = "或=者砍价的帮砍人数")
    @ApiModelProperty(value = "拼团达成数量(或=者砍价的帮砍人数)")
    private Integer needPerson;

    /** 拼团、或砍价成功次数 */
    @Excel(name = "拼团、或砍价成功次数")
    @ApiModelProperty(value = "拼团、或砍价成功次数(拼团、或砍价成功次数)")
    private Integer successNumber;

    /** 已销售商品数 */
    @Excel(name = "已销售商品数")
    @ApiModelProperty(value = "已销售商品数(已销售商品数)")
    private Long saleStock;
    /**
     * 活动信息
     */
    @ApiModelProperty(value = "活动信息")
    private ActivityInfoVo activityInfo;
    /**
     *  活动结束时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "活动结束时间")
    private Date endTime;


    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "活动开始时间")
    private Date beginTime;

    /**
     * 活动剩余库存
     */
    @ApiModelProperty(value = "活动剩余库存")
    private Long stock;

    /**
     * 商品库存
     */
    @ApiModelProperty(value = "商品库存")
    private Long stockNumber;

    @ApiModelProperty(value = "商品价格")
    private Long retailPrice;

    @ApiModelProperty(value = "活动倒计时")
    private long endTimes;

    @ApiModelProperty(value = "活动开始倒计时")
    private long statrTimes;

    /**
     * 活动状态
     */
    private String activityStatus;

    /**
     * 活动商品状态
     */
    private String activityProStatus;

    @ApiModelProperty(value = "是否参加了(false/true)")
    private Boolean isJoin;

    @ApiModelProperty(value = "参与的编号")
    private Long joinUid;

    @ApiModelProperty(value = "活动参与者")
    private List<ActivityJoinVo> joinVoList;

    @ApiModelProperty(value = "支付预留时长，分钟")
    private Long payMinute;

    @ApiModelProperty(value = "活动商品ID集合")
    private String productUids;

    public Long getPayMinute() {
        if (payMinute == null)
            return 60L;
        return payMinute;
    }

    @ApiModelProperty(value = "活动价格(格式化)")
    private String activityPriceStr;

    public String getActivityPriceStr() {

        return MoneyUtils.changeF2B(activityPrice);
    }

    public void setctivityPriceStr(String retailPriceStr) {
        this.activityPriceStr = activityPriceStr;
    }

    public String getRetailPriceStr(){
        return MoneyUtils.changeF2B(retailPrice);
    }

}
